﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DiffusionAnalyticalSolution
{
    public class Communication
    {
        public int[] _bitValues;
        public double[] _fracValues;

        public Communication(int numberOfBits)
        {
            _bitValues = new int[numberOfBits];
            _fracValues = new double[numberOfBits];
        }

        public void InitializeRandomForEyeDiagram(int oneOverRatio)
        {
            var random = new Random(71);

            _bitValues.Initialize();

            for (int i = 0; i < _bitValues.Length; i = i + oneOverRatio)
            {
                _bitValues[i] = (random.NextDouble() >= 0.5) ? 1 : 0;
            }
        }

        public void InitializeRandom()
        {
            var random = new Random(71);

            for (int i = 0; i < _bitValues.Length; i++)
            {
                _bitValues[i] = (random.NextDouble() >= 0.5) ? 1 : 0;
            }
        }

        public void InitializeFirstOneRestZero()
        {
            _bitValues[0] = 1;

            for (int i = 1; i < _bitValues.Length; i++)
            {
                _bitValues[i] = 0;
            }
        }

        public void InitializeAllOnes()
        {
            for (int i = 0; i < _bitValues.Length; i++)
            {
                _bitValues[i] = 1;
            }
        }
    }
}
